package com.tbs.parkingsaleapp.SystemManager.FileMananger;

import android.content.Context;
import android.content.SharedPreferences;

public class LittleDataMananger {

    private static final String FILENAME="little.xml";
    public static void SaveBoolean(Context context,String key, boolean value)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor= sp.edit();
        editor.putBoolean(key,value);
        editor.commit();
    }
    public static void Remove(Context context,String key)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor= sp.edit();
        editor.remove(key);
        editor.commit();
    }
    public static void SaveLong(Context context,String key,long value)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor= sp.edit();
        editor.putLong(key,value);
        editor.commit();
    }
    public static void SaveFloat(Context context,String key, float value)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor= sp.edit();
        editor.putFloat(key,value);
        editor.commit();
    }
    public static void SaveString(Context context,String key, String value)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor= sp.edit();
        editor.putString(key,value);
        editor.commit();
    }
    public  static boolean ReadBool(Context context,String key)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        return sp.getBoolean(key,false);
    }
    public  static float ReadFloat(Context context,String key)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        return sp.getFloat(key,-1);
    }
    public  static long ReadLong(Context context,String key)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        return sp.getLong(key,-1);
    }
    public  static String ReadString(Context context,String key)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        return sp.getString(key,"");
    }
    public static boolean Contain(Context context,String key)
    {
        SharedPreferences sp= context.getSharedPreferences(FILENAME,Context.MODE_PRIVATE);
        return sp.contains(key);
    }
}
